home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / axtree / clsnodes.cls < prev    next >
Encoding:
Visual Basic class definition  |  1998-05-05  |  2.0 KB  |  85 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "clsNodes"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = False
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Private prvNodes As New Collection
  11.  
  12. Public Function Add(mCaption As String, mLevel As Integer, mIsParent As Boolean, _
  13.                                 Optional mVisible, Optional mExpanded, Optional mVisibleIdx, _
  14.                                 Optional mBookmark, Optional mBmpFileName, Optional mSelected, Optional mSyncIdx, _
  15.                                 Optional mItemData)
  16.   Dim newitem As New clsItem
  17.   With newitem
  18.     .Caption = mCaption
  19.     .Level = mLevel
  20.     .IsParent = mIsParent
  21.     .Visible = IIf(IsMissing(mVisible), True, mVisible)
  22.     .Expanded = IIf(IsMissing(mExpanded), True, mExpanded)
  23.     .VisibleIdx = IIf(IsMissing(mVisibleIdx), 0, mVisibleIdx)
  24.     .Bookmark = IIf(IsMissing(mBookmark), "", mBookmark)
  25.     .BmpFileName = IIf(IsMissing(mBmpFileName), "", mBmpFileName)
  26.     .Selected = IIf(IsMissing(mSelected), 0, mSelected)
  27.     .SyncIdx = IIf(IsMissing(mSyncIdx), 0, mSyncIdx)
  28.     .ItemData = IIf(IsMissing(mItemData), 0, mItemData)
  29.   End With
  30.    
  31.   Debug.Print mNodes.Levels
  32.   prvNodes.Add newitem
  33.   'Add = True
  34.   
  35. End Function
  36.  
  37. Public Function Count() As Integer
  38.   Count = prvNodes.Count
  39. End Function
  40.  
  41. Public Function Item(ByVal key As Variant) As Object
  42. Attribute Item.VB_UserMemId = 0
  43.   On Error GoTo errorexit
  44.   If VarType(key) = vbString Then
  45.     key = Trim(key)
  46.   End If
  47.   
  48.   Set Item = prvNodes.Item(key)
  49.   Exit Function
  50.   
  51. errorexit:
  52.   
  53. End Function
  54.  
  55. Public Function Clear() As Variant
  56.   On Error GoTo errorexit
  57.   
  58.   Do Until prvNodes.Count = 0
  59.     prvNodes.Remove 1
  60.   Loop
  61.   
  62.   Clear = True
  63.   
  64.   On Error GoTo 0
  65.   
  66. Exit Function
  67. errorexit:
  68.       
  69. End Function
  70.  
  71. Public Function Remove(index As Integer) As Variant
  72.   On Error GoTo errorexit
  73.   
  74.   prvNodes.Remove index
  75.   
  76.   Remove = True
  77.   
  78.   On Error GoTo 0
  79.   
  80. Exit Function
  81. errorexit:
  82.       
  83. End Function
  84.  
  85.